import { Operation } from "./operations";

export class InsertTextOperation extends Operation{
  private spacers_: any;
  private insertIndex_: number;
  constructor(spacers: any, insertIndex: number) {
    super()
    this.spacers_ = spacers
    this.insertIndex_ = insertIndex
  }
  getSpacers() {
    return this.spacers_
  }
  setSpacers (spacers: any) {
    this.spacers_ = spacers
  }
  /**
   * @description 插入文本
   * @param editor editor 类
   */
  apply(editor: any): void {
      editor.getTextModel().insert(this.insertIndex_, this.spacers_)
  }
}

export default InsertTextOperation